<template>
  <div class="dashboard-container">
    <!-- 面板统计组件 -->
    <panel-group
      :userTotal="userTotal"
      :articleTotal="articleTotal"
    />
  </div>
</template>

<script>
import PanelGroup from "./components/PanelGroup";

import api from "@/api/home";

export default {
  name: "DashBoard",
  components: {  PanelGroup },

  data() {
    return {
      userTotal: 0,
      flag: false, // 判断是否显示图表组件
    };
  },

  mounted() {
    this.getTotal();
  },

  methods: {
    async getTotal() {
      //查询总用户。 data取别名userTotal
      const { data: userTotal } = await api.getUserTotal();
      this.userTotal = userTotal;
    },
  },
};
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
